// Configuration.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "Configuration.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#include "ChangePassword.h"

/////////////////////////////////////////////////////////////////////////////
// CConfiguration property page

IMPLEMENT_DYNCREATE(CConfiguration, CPropertyPage)

CConfiguration::CConfiguration() : CPropertyPage(CConfiguration::IDD)
{
	//{{AFX_DATA_INIT(CConfiguration)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

CConfiguration::~CConfiguration()
{
}

void CConfiguration::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CConfiguration)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CConfiguration, CPropertyPage)
	//{{AFX_MSG_MAP(CConfiguration)
	ON_BN_CLICKED(IDC_ConfigurationSet, OnConfigurationSet)
	ON_BN_CLICKED(IDC_SetPassword, OnSetPassword)
	ON_BN_CLICKED(IDC_OpenMapAP, OnOpenMapAP)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CConfiguration message handlers

BOOL CConfiguration::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	if (!m_Configuration.Create(this))
		g_GlobalObj.UIWriteLog("m_Configuration.Create Error");
		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


BOOL CConfiguration::OnKillActive() 
{
/*	if(!m_Configuration.UpdateMemberVariables())
		g_GlobalObj.UIWriteLog("m_Configuration.UpdateUI Error");
*/	
	return CPropertyPage::OnKillActive();
}

BOOL CConfiguration::OnSetActive() 
{
	if(!m_Configuration.UpdateUI())
		g_GlobalObj.UIWriteLog("m_Configuration.UpdateUI Error");
	
	return CPropertyPage::OnSetActive();
}

void CConfiguration::OnConfigurationSet() 
{
	if(!m_Configuration.Set())
		g_GlobalObj.UIWriteLog("m_Configuration.Set Error");

}


void CConfiguration::OnSetPassword() 
{
	CChangePassword ChangePasswdDlg;
	ChangePasswdDlg.DoModal();
	
}


void CConfiguration::OnOpenMapAP() 
{
	if(!m_Configuration.ChooseMapAp())
		g_GlobalObj.UIWriteLog("m_Configuration.ChooseMapAp Error");

}
